
function crush = getfinish(Car)
% get the current nearest dispart between car and the edge
% 用于探测是否到达重点，只需要在碰撞时检测即可
Edge = [
% 2.998806	0.220528 30.323206	15.844528;
% 30.323206	15.844528 23.792806	29.414528;
% 23.792806	29.414528 -4.748594	12.996528;
-4.748594	12.996528 2.998806	0.220528% A


%11.149906	18.121528 -3.120794	9.912528;%B

%12.777706	15.037528 -1.492994	6.828528;%C
% 
% 1.380606	2.756528 15.301006	10.696528;
% 15.301006	10.696528 14.405506	11.953528;
% 14.405506	11.953528 0.134806	3.744528;
% 0.134806	3.744528 1.380606	2.756528;%D


];



crush=10;

for i=1:length(Edge)
    % r 的返回长度为 size(car)（1）
    r = disMin([Edge(1),Edge(2)],[Edge(3),Edge(4)],Car);
    for j = 1:length(r)
          if r(j)<crush
       crush = r(j);
    end
    end

end

